var player = new Vue({
    el:'#player',
    data:{
        search:"周杰伦",
        //歌曲列表
        musicList:[],
        //歌曲地址
        musicSrc:'',
        //歌曲封面
        musicImg:"",
        //歌曲评论
        musicTalks:[],
        //视频地址
        mvUrl:""
    },
    methods:{
        searchMusic:function(){
        var that = this;
            axios.get("https://autumnfish.cn/search?keywords="
             + this.search)
             .then(function(resp){
                 that.musicList = resp.data.result.songs;
             })
             .catch(function(err){
                 console.log(err)
             })
        },
        play:function(item){
            var that = this;
            //获取播放列表
            axios.get("https://autumnfish.cn/song/url?id="+item.id)
            .then(function(resp){
               that.musicSrc = resp.data.data[0].url
            })
            //获取歌曲专辑图片
            axios.get("https://autumnfish.cn/song/detail?ids="+item.id)
            .then(function(resp){
               that.musicImg = resp.data.songs[0].al.picUrl
            })
            //获取评论
            axios.get("https://autumnfish.cn/comment/hot?type=0&id="+item.id)
            .then(function(resp){
                
                that.musicTalks  = resp.data.hotComments
            })
        },
        //播放mv
        playMv:function(mvid){
            var that = this;
            axios.get("https://autumnfish.cn/mv/url?id="
            + mvid)
            .then(function(resp){
               
                console.log(resp.data.data.url);
                that.mvUrl = resp.data.data.url
            })
       }
    },
})